export default {

    data() {
        return {};
    },

    methods: {
        // 获取订单详情
        async getOrderDetail(id_) {
            let _data = await this.$vFN.Http.post({
                url: "admin/order/detail",
                data: {
                    orderId: id_
                },
            }, window);
            if (_data._ok) {
                return _data.data
            } else {
                return false
            }
        },

        // 获取售后的订单详情
        async getOrderRefundDetail(id_) {
            let _data = await this.$vFN.Http.post({
                url: "admin​/rights​/detail",
                data: {
                    orderRightsId: id_
                },
            }, window);
            if (_data._ok) {
                return _data.data
            } else {
                return false
            }
        },
     
        // 全部订单的订单详情
        async OrderDetailsCilck(item_) {
            let _data = await this.getOrderDetail(item_.id);
            this.OrderDetails(_data)

        },
        // 售后订单的订单详情
        async OrderRefundDetailCilck(item_) {
            let _data = await this.getOrderRefundDetail(item_.id)
            this.RefundDetails(_data)

        },
        // 订单详情 弹窗
        async OrderDetails(r) {
            // 打开加载遮罩层
            this.$vFN.Tools.setLoad(true);
            let _d = await import("@/directives/OrderDetails/index");
            // 关闭加载遮罩层
            this.$vFN.Tools.setLoad(false);
            _d.default.init({
                item: r,
                onSuccess: (r) => {
                    this.mixinTable_refreshData();
                },
            })
        },

        // 售后订单详情 弹窗
        async RefundDetails(r) {
            // 打开加载遮罩层
            this.$vFN.Tools.setLoad(true);
            let _d = await import("@/directives/RefundDetails/index");
            // 关闭加载遮罩层
            this.$vFN.Tools.setLoad(false);
            _d.default.init({
                item: r,
                onSuccess: (r) => {
                    this.mixinTable_refreshData();
                },
            })

        },

        // 售后状态转换文字
        refundStatus(number) {
            let text;
            switch (number) {
                case 1:
                    text = "可售后"
                    break;
                case 2:
                    text = "售后中"
                    break;
                case 3:
                    text = "已售后"
                    break;
                case 4:
                    text = "关闭售后"
                    break;
                default:
                    text = "无";
            }
            return text
        },

        // 支付方式转换文字
        payManner(object) {

            let text;
            if (!this.$vFN.Utils.isEmpty(object) && !this.$vFN.Utils.isEmpty(object.payType)) {
                switch (object.payType) {
                    case 1:
                        text = "货到付款"
                        break;
                    case 2:
                        text = "余额支付"
                        break;
                    case 3:
                        text = "微信支付"
                        break;
                    default:
                        text = "无";
                }
            } else {
                text = "无";
            }

            return text
        },

        // 收货地址拼接文字
        addressName(object) {
            let text;
            if (!this.$vFN.Utils.isEmpty(object)) {
                text = `${object.province}${object.city}${object.region}${object.detailAddress}${object.street}`
            } else {
                text = "无"
            }

            return text
        },

        // 送货方式转换文字
        deliveryWay(number) {
            let text;
            switch (number) {
                case 1:
                    text = "无需物流"
                    break;
                case 2:
                    text = "商家配送"
                    break;
                case 3:
                    text = "到店自提"
                    break;
                default:
                    text = "无";
            }

            return text
        },

    },
};